/*
package com.example.demo.commons.core.validator.constraintvalidators;

import cn.hutool.core.collection.CollectionUtil;
import com.example.demo.commons.core.util.LocalEnumUtils;
import com.example.demo.commons.core.validator.constraints.EnumLimit;
import lombok.Setter;

import java.util.List;
import java.util.Objects;

*/
/**
 * 校验传入值是否在枚举code范围内
 *
 * @author qingzhi
 *//*

@Setter
public class EnumInterfaceLimitValidatorImpl implements ConstraintValidator<EnumLimit, Integer> {

    private List<Integer> codes;

    @Override
    public void initialize(EnumLimit constraintAnnotation) {
        this.codes = LocalEnumUtils.getEnumCodes(constraintAnnotation.enumInterface());
    }

    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {
        if (Objects.isNull(value)) {
            return true;
        }
        if (CollectionUtil.isNotEmpty(codes) && codes.contains(value)) {
            return true;
        }
        return false;
    }
}*/
